package controllers

type ResCode int

const (
	CodeSuccess ResCode = 1000 * iota
	CodeInvalidParam
	CodeUserExits
	CodeUserNotExits
	CodePasswordError
	CodeRegisterError
	CodeServerBusy
	CodeErrorMsg
	CodeEmailNotExits
	CodeEmailExits

	CodeTagExits
	CodeTagNotExits
	CodeTagError

	CodeArticleExits
	CodeUserIdExits
	CodeArticleNotExits
)

var ResMsg = map[ResCode]string{
	CodeSuccess:       "success",
	CodeInvalidParam:  "参数不正确",
	CodeUserExits:     "用户已存在",
	CodeEmailExits:    "邮箱已存在",
	CodeEmailNotExits: "邮箱不存在",
	CodeUserNotExits:  "用户不存在",
	CodePasswordError: "密码错误",
	CodeRegisterError: "注册失败",
	CodeServerBusy:    "服务器繁忙",

	CodeTagExits:    "标签已存在",
	CodeTagNotExits: "标签不存在",
	CodeTagError:    "标签创建失败",

	CodeArticleExits:    "文章已经存在",
	CodeUserIdExits:     "用户ID不存在",
	CodeArticleNotExits: "文章不存在",
}

func (c ResCode) GetMsg() string {
	return ResMsg[c]
}
